import config from "../conf/Config.js";

import staticConst from "../const/StaticConst.js";

import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);
let that = Vue.prototype;
let api = that.$api;
var https = {};

https.logout = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.LOG_OUT;
	let backData = null;
	let res = await api({
		url: url,
		data: data || {}
	});
	
	if (res) {
		backData = res;
	}
	if (that.$store) {
		that.$store.commit("setLogOut");
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**********服务预约*************/
/*****服务预约购物列表****/
https.getYYCartInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YY0_CART_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/****服务预约抄单，退货，编辑草稿****/
https.copyYYReturnEdit = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YY0_ORDER_COPY;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/**********服务预约*************/


// 批量修改产品
https.delgoods = async function (data, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GDLS_SAVE;
	let param = data;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.spec_ls) {
		return backData;
	} else {
		if (res.status == 1) {
			backData = res.data.spec_ls;
		}
	}
	return backData;
}

// 批量修改服务
https.YYdelgoods = async function (data, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YY_GOODSINFO_GOODS_SAVE;
	let param = data;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.spec_ls) {
		return backData;
	} else {
		if (res.status == 1) {
			backData = res.data.spec_ls;
		}
	}
	return backData;
}

// 设置列表产品状态
https.setListItemStatus = async function (data, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GOODS_SAVE_LS;
	let param = data;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.spec_ls) {
		return backData;
	} else {
		if (res.status == 1) {
			backData = res.data.spec_ls;
		}
	}
	return backData;
}

/****添加产品***/
https.addGoods = async function (back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.ADD_GOODS;
	let param = {};
	let res = await api({
		url: url,
		data: param
	});
	let backData = null;
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			res.data.actType = 0; //新增
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****添加服务***/
https.addProject = async function (back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YY_GOODSINFO_ADD_DETAIL;
	let param = {};
	let res = await api({
		url: url,
		data: param
	});
	let backData = null;
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			res.data.actType = 0; //新增
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***加载规格列表,规格列表数据****/
https.loadSpecList = async function (data, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GDPRE_SPEC_LS;
	let param = data;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.spec_ls) {
		return backData;
	} else {
		if (res.status == 1) {
			backData = res.data.spec_ls;
		}
	}
	return backData;
}

/***加载产品单位列表***/
https.loadUnitList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GDPRE_UNIT_LS;
	let param = {};
	param.status = 1;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.unit_ls) {} else {
		if (res.status == 1) {
			backData = res.data.unit_ls;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***加载服务单位列表***/
https.loadProjectUnitList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PROPRE_UNIT_LS;
	let param = {};
	param.status = 1;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.unit_ls) {} else {
		if (res.status == 1) {
			backData = res.data.unit_ls;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***保存快递信息***/
https.setkdnoSave = async function (data, back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.DK100_KDNO_SAVE;
	let param = data;
	param.status = staticConst.GOODS_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (res.status == 1) {
		backData = res.status;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***查询订单物流列表***/
https.getkdnoList = async function (data, back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.DK100_KDNO_LS;
	let param = data;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (res.status == 1) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***查询快递公司列表***/
https.getdkList = async function (data, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.DK100_CP_GET;
	let param = data;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	return res;
}

/***加载产品品牌列表***/
https.loadBrandList = async function (data, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GDPRE_BRAND_LS;
	let param = data;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.brand_ls) {
		return backData;
	} else {
		if (res.status == 1) {
			backData = res.data.brand_ls;
		}
	}
	return backData;
}

/***加载服务品牌列表***/
https.loadprojectBrandList = async function (data, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PROPRE_BRAND_LS;
	let param = data;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.brand_ls) {
		return backData;
	} else {
		if (res.status == 1) {
			backData = res.data.brand_ls;
		}
	}
	return backData;
}

/***加载产品分类列表***/
https.loadCatList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GDPRE_CAT_LS;
	let param = {};
	param.status = staticConst.GOODS_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***加载产品分类列表***/
https.loadprojectCatList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PROPRE_CAT_LS;
	let param = {};
	param.status = staticConst.GOODS_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****加载产品标签列表*****/
https.loadTagList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GDPRE_TAG_LS;
	let param = {};
	param.status = staticConst.GOODS_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.tag_ls || !res.data.tag_ls.tag_ls) {} else {
		if (res.status == 1) {
			backData = res.data.tag_ls.tag_ls;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/****加载服务标签列表*****/
https.loadprojectTagList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PROPRE_TAG_LS;
	let param = {};
	param.status = staticConst.PROPRE_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.tag_ls) {} else {
		if (res.status == 1) {
			backData = res.data.tag_ls;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/***仓库列表*****/
https.loadStoreList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.STORE_LS;
	let param = {};
	param.ismy = 1;
	param.md = staticConst.ORDER_XS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;

}

/***加载产品价格列表***/
https.loadPriceList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GDPRE_PRICE_LS;
	let param = {};
	param.status = staticConst.GOODS_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.price_ls) {} else {
		if (res.status == 1) {
			backData = res.data.price_ls;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***加载服务价格列表***/
https.loadProjectPriceList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PROPRE_PRICE_LS;
	let param = {};
	param.status = staticConst.GOODS_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.price_ls) {} else {
		if (res.status == 1) {
			backData = res.data.price_ls;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***加载服务成本列表***/
https.loadProjectCostList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PROPRE_COST_LS;
	let param = {};
	param.status = staticConst.GOODS_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data || !res.data.cost_ls) {} else {
		if (res.status == 1) {
			backData = res.data.cost_ls;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**获取我的门店**/
https.loadMyShopList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.SHOP_LS;
	let param = {};
	param.ismy = 1;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***加载产品属性详情列表****/
https.loadAttrList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GDPRE_ATTR_LS;
	let param = {};
	param.status = staticConst.GOODS_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***加载服务属性详情列表****/
https.loadprojectAttrList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PROPRE_ATTR_LS;
	let param = {};
	param.status = staticConst.GOODS_STATUS;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	let backData = null;
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***经手人列表***/
https.loadUcpList = async function (back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.UCP_LS;
	let param = {};
	param.md = staticConst.ADD_GOODS;
	param.ch = 1;
	let backData = null;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***退货***/
https.orderReturnGd = async function (data, back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.ORDER_RETURN_GD;
	let param = data;
	let backData = null;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	if (res.status == 1) {
		backData = res.status;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***计算器***/
https.commonCount = async function (data, back, showLoading = false) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.COMMON_COUNT;
	let param = data;
	param.md = staticConst.ADD_GOODS;
	param.ch = 1;
	let backData = null;
	let res = await api({
		url: url,
		data: param,
		showLoading: showLoading
	});
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/***************服务详情*****************/
https.loadprojectInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YY_GOODSINFO_EDIT_DETAIL;
	let param = data;
	let backData = null;
	let res = await api({
		url: url,
		data: param
	});
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/***************产品详情*****************/
https.loadGoodsInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GD_INFO;
	let param = data;
	let backData = null;
	let res = await api({
		url: url,
		data: param
	});
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = res.data;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/******添加保存产品******/
https.saveAddGds = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.SAVE_GOODS;
	let param = data;
	let backData = null;
	let res = await api({
		url: url,
		data: param
	});
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData = {}
			backData = res.data;
			backData.act = data.act;
			backData.goods_id = data.goods_id;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/******添加保存服务******/
https.saveProjectAddGds = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YY_GOODSINFO_SAVE_GOODS;
	let param = data;
	let backData = null;
	let res = await api({
		url: url,
		data: param
	});
	if (res || res.data) {
		if (res.status == 1) {
			backData = {}
			backData = res.data;
			backData.act = data.act;
			backData.goods_id = data.goods_id;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*************编辑产品上传****************/
https.uploadsGoods = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.UPDATE_GOODS;
	let param = data;
	let backData = {};

	let res = await api({
		url: url,
		data: param
	});
	if (!res || !res.data) {} else {
		if (res.status == 1) {
			backData.act = data.act;
			backData.goods_id = data.goods_id;
		}
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/*************编辑服务上传****************/
https.uploadsProjectGoods = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YY_GOODSINFO_UPDATE_GOODS;
	let param = data;
	let backData = {};

	let res = await api({
		url: url,
		data: param
	});

	if (res.status == 1) {
		backData.act = data.act;
		backData.id = data.gdid;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/******删除产品*******/
https.delGoods = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.DEL_GOODS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/******删除服务*******/
https.delPorjectGoods = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YY_GOODSINFO_DEL_GOODS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****编辑,复制产品*******/
https.editGoods = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.EDIT_GOODS_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****产品es关键词搜索关键词*****/
https.searchObjType = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.SEARCH_S_OBJTYPE_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****根据选择的类型和输入的关键字搜索****/
https.searchKwByObjType = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.SEARCH_S_OBJTYPE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****单据记录搜索******/
https.saveCustom = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****单据记录搜索******/
https.searchKwBillList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.SEARCH_S_ORDERS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/******按分类和关键字搜索服务*******/
https.searchXmsCatAndKwList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.SEARCH_S_GOODS_YY;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/******按分类和关键字搜索产品*******/
https.searchGdsCatAndKwList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.SEARCH_S_GOODS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****打开vip第一步*******/
https.loginVipGetSign = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.LOGIN_GET_SIGN;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****打开vip第二步*****/
https.pcLoginVip = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.LOGIN_PC;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		app: ""
	}); //打开不带app参数
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/******客户***BEGIN****/
/********客户列表接口********/
https.customList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***客户详情******/
https.getCustomInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
https.searchCustomCatAndKwList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.SEARCH_S_CUSTOMER;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****添加/编辑客户****/
https.saveSupp = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_SUPP_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/******删除客户*****/
https.delCustom = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_DEL;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

// 智能分析
https.customAnalyInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_ANALY_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

//其他相关
/******
url : CUSTOM_GOODS_LS : "custom/goods_ls", //客户产品销售
参数：
customerid:客户编号
is_yy : 预约板块 1是2否默认否
pform:
pnum:
****/
https.customGoodsList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_GOODS_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/******
url:
CUSTOM_ORDER_GD : "custom/order_gd",//客户产品销售-产品详细
参数：
type:订单类型
odid:订单id
gdid:产品id
********/
https.customOrderGd = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_ORDER_GD;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/***********
url : CUSTOM_ORDER2_LS : "custom/order2_ls",//客户历史订单-退货单
参数：customerid，pform，pnum
***********/
https.customOrder2List = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_ORDER2_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/****************
url:CUSTOM_ORDER_LS : "custom/order_ls",//客户历史订单-销售单
参数：customerid，pform，pnum
*************/
https.customOrderList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_ORDER_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/**********************
url:CUSTOM_AMOUNT_LS2 : "custom/amount_ls2",//客户累计销售
参数：
customerid :客户编号 必须
page:	页面开始id 默认 0 近一年，1 近第二年 2 近第三年 建议前端 给出最大限值 100
*************/
https.customAmountList2 = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_AMOUNT_LS2;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**********************
url:CUSTOM_AMOUNT_LS : "custom/amount_ls",//客户累计预约
参数：
customerid :客户编号 必须
page:	页面开始id 默认 0 近一年，1 近第二年 2 近第三年 建议前端 给出最大限值 100
*************/
https.customAmountList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_AMOUNT_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***********
url:CUSTOM_ORDER_RECE_LS : "custom/order_rece_ls", //客户订单应收
参数：
customerid:客户id
pform ：翻页开始id
pnum : 每页数量
is_yy : 预约板块 1是2否 默认2
act : 模式： see 查看模式 【有分页】,down 下载模式 ,默认为查看模式
************/
https.customOrderReceList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_ORDER_RECE_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/************************
url:CUSTOM_ORDERINFO : "custom/custom_orderinfo", //客户订单详细+客户信息
参数：
id:订单编号
**************/
https.customOrderInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_ORDERINFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


//客户标签
/****************
url:CUSTOM_TAG_SAVE : "custom/tag_save", // 客户标签-【修改、新增】
参数：
id : 新增设为0 修改时为 对应的id
title : 	标签名称
status : 状态 1 正常 2 启用
**************/
https.customTagSave = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TAG_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****************
url:CUSTOM_TAG_DEL : "custom/tag_del",//客户标签-【删除】
参数：id: 标签id
***************/
https.customTagDel = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TAG_DEL;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****************
url:CUSTOM_TAG_LS : "custom/tag_ls",//客户标签-列表
参数 :
status : 状态 1 ,2 1正常，2 停用
************/
https.customTagList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TAG_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

//客户类型
/**************
url:CUSTOM_TYPE_SAVE : "custom/customtype_save", //-客户类型-【修改、新增】
参数：
id， title
**************/
https.customTypeTagSave = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TYPE_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*************
url:CUSTOM_TYPE_DEL : "custom/customtype_del", //客户类型-【删除】
参数：
id
*************/
https.customTypeTagDel = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TYPE_DEL;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****************
url:CUSTOM_TYPE_LS : "custom/customtype_ls",//客户类型-列表
参数:
************/
https.customTypeTagList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TYPE_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

//客户跟进
/****************
url:CUSTOM_TXT_SAVE : "custom/txt_save",//客户保存跟进-【修改、新增】
参数:
id:	保留参数【编辑功能暂不开放】 新增设为0 修改时为 对应的id
customerid : 客户id
cid:跟进类型
txt:跟进描述 文本类型 和参数[ imgs ]必填一个
imgs:图片 复检 数组方式 最多九个 和参数[ txt]必填一个
status : 保留参数 编辑时候 可传限定值 1 ,2
*************/
https.customTxtSave = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TXT_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****************
url:CUSTOM_TXT_LS : "custom/txt_ls", //客户跟进-列表
参数:
customerid:跟进的客户id 必填
cid:跟进类型id
group:日期筛选 1 本日 2 本月 3 本季 四 本年
uid_cp:经手人
pfrom:分页参数 页码
pnum:	分页参数 页数据量
**********/
https.customTxtList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TXT_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***********
url:CUSTOM_TXT_CAT_SAVE : "custom/txt_cat_save",//客户跟进类型-【修改、新增】
参数:
id:新增设为0 修改时为 对应的id
title:标签名称
status:状态 1 正常 2 启用
***************/
https.customTxtCatSave = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TXT_CAT_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****************
url:CUSTOM_TXT_CAT_DEL : "custom/txt_cat_del",//客户跟进类型-【删除】
参数 id
****************/
https.customTxtCatDel = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TXT_CAT_DEL;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****************
url:CUSTOM_TXT_CAT_LS : "custom/txt_cat_ls",//客户跟进类型-列表
参数：
status:	状态 1 ,2 1正常，2 停用
*****************/
https.customTxtCatList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_TXT_CAT_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

//收款相关
/***************
url:CUSTOM_BILL_LS : "custom/bill_ls",// 客户收款流水
参数： customerid,pform,pnum
***********/
https.customBillList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_BILL_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****************
url:CUSTOM_RECOMMEND_LIST : "yx/ds/share_ls",//客户推荐列表
参数：customerid
************/
https.customRecommendList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YX_DS_SHARE_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****************
url:CUSTOM_BILL_INFO : "custom/bill_info",//客户收款详细
参数：id
************/
https.customBillInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_BILL_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****************
url : CUSTOM_RECE_SAVE : "custom/rece_save",//客户收预付款
参数:
customerid :必填，客户编号
payid:必填，支付方式id
money:必填，支付金额
txt:备注 选填
***********/
https.customReceSave = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_RECE_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****************
url: CUSTOM_RECE_LS : "custom/rece_ls", //客户预付款流水
参数:
customerid : 必填，客户编号
is_yy : 	是否为预约板块 1是其他否
pform :   开始id
pnum :	页面数量
*************/
https.customReceList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_RECE_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*************
CUSTOM_CTOD_SAVE : "custom/ctod_save",//转成老客户
参数：
id:客户id
***********/
https.customChangeOld = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CUSTOM_CTOD_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/******客户***END****/


/*****开单*****/
https.getSettingSell = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	/******
	is2amount:"默认收款为应收，1是2否"
	is_seller:"显示经手人，1是2否"
	is_txt:"显示单据备注，1是2否"
	is_zk_sku:"开单是否显示折扣-sku，1是2否"
	isscan_act:	"扫码时动作，开单时扫码时动作，1直接开单；2去加购"
	isscan_num_step	:	"扫码加购时按下单数量加减步长，1是2否"
	money_p	:	"价格小数位"
	num_min	:	"产品起订量，对于每个sku"
	num_p	:	"数量小数位"
	num_step	:	"下单数量加减步长，不支持多规格多条码"
	price_quote_type_gd	:	"开单报价方式，0：无关联 1：按单位 2： 按规格"
	*****/

	let url = config.SETTING_SELL;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****购物列表****/
https.getCartInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CART_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****产品-规格单位*****/
https.getGoodsSpec = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GOODS_SPEC;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****开单-获取产品价格（含上次报价）*****/
https.getGdPrice = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GD_PRICE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***提交购物车****/
https.saveCart = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CART_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***折扣，抹零****/
https.orderCount = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.ORDER_COUNT;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/********开单-去结账*********/
https.orderCheckout = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.ORDER_CHECKOUT;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/********开单-结账提交/新增单据/草稿单*********/
https.orderAdd = async function (data, back, app) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.ORDER_ADD;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		app: app
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/******获取中国行政区******/
https.districts = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.COMM_DISTRICTS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****微信支付生成二维码****/
https.wxPayQrcode = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PAY_WX_PARAM;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		payKey: config.WX_PAY_KEY
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****获取费用-列表****/
https.getFeeList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.FEE_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****抄单，退货，编辑草稿****/
https.copyReturnEdit = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.ORDER_COPY;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/******本地打印获取模板******/
https.getLocalPrintConfig = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GET_PRINT_SET;
	data.type = staticConst.ORDER_XS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***打印次数累计***/
https.printCount = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PRINT_COUNT;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****请求云店列表****/
https.getPrintYunList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.PRINTER_YUN_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/******调用云打印*******/
https.doYunPrint = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.COMM_PRINT_DO;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****获取云店列表****/
https.loadYdlist = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.YUN_SHOP_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/*******采购开单***BEGIN*****/
/**CG_CART_INFO : "cg/order/cart_info",//采购开单购物车-读取**/
https.cgCartInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_CART_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_ORDER_COUNT : "cg/order/order_count",//采购开单-订单金额结算（折扣/抹零计算）**/
https.cgOrderCount = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_COUNT;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_CART_SAVE : "cg/order/cart_save",//采购开单购物车-加购/修改价格数量**/
https.cgCartSave = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_CART_SAVE;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_ORDER_SPEC_LS : "cg/order/order_spec_ls",//采购开单-购买记录**/
https.cgOrderSpecList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_SPEC_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_GD_PRICE : "cg/order/gd_price", //采购开单-获取产品价格（含上次报价）**/
https.cgGdPrice = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_GD_PRICE;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_GD_SKU_BYINFO : "cg/order/gd_sku_byinfo", //采购开单-获取产品sku上次交易信息**/
https.cgGdSkuByinfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_GD_SKU_BYINFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_ORDER_ADD : "cg/order/order_add", //采购开单-结账提交/新增单据**/
https.cgOrderAdd = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_ADD;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_ORDER_CHECKOUT : "cg/order/order_checkout", //采购开单-去结账***/
https.cgOrderCheckout = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_CHECKOUT;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****CG_ORDER_SETTING_SELL : "cg/order/setting_sell", //采购开单-相关设置读取***/
https.cgSettingSell = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_SETTING_SELL;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/*******采购开单***END*****/

/*******采购单据***BEGIN*****/
/****CG_ORDER_LS : "cg/order/order_ls",//采购单据-列表*****/
https.cgOrderList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_ORDER_COPY : "cg/order/order_copy",//采购单据-抄单/退货/草稿单编辑**/
https.cgOrderCopy = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_COPY;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_ORDER_PAY : "cg/order/order_pay",//采购单据-操作（收款/退款）**/
https.cgOrderPay = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_PAY;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_ORDER_INFO : "cg/order/order_info",//采购单据-详情（同时抢加锁，退出详情解锁）**/
https.cgOrderInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**CG_ORDER_ACT : "cg/order/order_act",//采购单据-操作（常规+解锁）**/
https.cgOrderAct = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_ORDER_ACT;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/*******采购单据***END*****/
https.cgSuppList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return res;
}

/******按分类和关键字搜索供应商*******/
https.searchSuppCatAndKwList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SEARCH_S_SUPP;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/***供应商详情******/
https.getSuppmInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
// 供应商产品销售
https.suppGoodsList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_GOODS_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
// 供应商历史订单
https.suppOrderList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_ORDER_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
// 供应商收款流水
https.suppBillList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_BILL_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

// 供应商供货流水
https.suppAmountList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_AMOUNT_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
// 供应商预付款流水
https.suppReceList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_RECE_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

// 供应商单据欠款流水
https.suppOderReceList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_ORDER_RECE_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

// 删除供应商
https.suppDel = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_SUPP_DEL;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

// 添加/编辑供应商
https.suppDel = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.CG_SUPP_SUPP_DEL;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/*******供应商********/

/***库管**BEGIN**/
https.getCgKgGdList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.STORE_GOODS_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/*******GOODS_STORE : "ck/store/goods_store", // 产品库存******/
https.getGoodsStore = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GOODS_STORE;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****GOODS_STORE_LOG : "ck/store/goods_store_log",//库存流水*****/
https.getGoodsStoreLog = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GOODS_STORE_LOG;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****GOODS_STORE_LOG_DETAIL : "ck/store/goods_store_log_detail",//库存流水详情*****/
https.getGoodsStoreLogDetail = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GOODS_STORE_LOG_DETAIL;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/*****GOODS_STORE_EDIT : "ck/store/goods_store_edit", //产品库存修改*****/
https.getGoodsStoreEdit = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.GOODS_STORE_EDIT;
	let backData = null;
	let res = await api({
		url: url,
		data: data,
		showLoading: false
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/***库管**END**/



/************报表****BEIND*******/
//采购
/****REPORT_GOODS_STORE : "report/goods_store",//产品库存****/
https.getReportGdStore = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_GOODS_STORE;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****REPORT_STORE_COUNT : "report/store_count",//仓库统计****/
https.getReportStoreCount = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_STORE_COUNT;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

//仓库
/****REPORT_STORE_VIEW : "report/store_view",//仓库概览****/
https.getReportStoreView = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_STORE_VIEW;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****REPORT_GOODS_STORE_LOG : "report/goods_store_log", //库存流水****/
https.getReportGdStLog = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_GOODS_STORE_LOG;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****REPORT_STORE_VIEW_LS : "report/store_view_ls", //产品库存概览****/
https.getReportStoreViewList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_STORE_VIEW_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****REPORT_STORE_INFO : "report/store_info", //仓库详情****/
https.getReportStoreInfo = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_STORE_INFO;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****REPORT_CG_COUNT : "report/cg_count",//采购报表****/
https.getReportPuchaseConut = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_CG_COUNT;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/****REPORT_CG_SELL_LS : "report/cg_sell_ls", //仓库采购记录****/
https.getReportPuchaseSellList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_CG_SELL_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**** REPORT_SHOP_COUNT : "report/shop_count",//销售表首页接口*****/
https.getReportShopConut = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_SHOP_COUNT;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**** ASSQ_SQ_SELL_COUNT : "asmh/report/asmh_sq_sell_count",//销售表首页接口*****/
https.getAsmhsqSellCount = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.ASSQ_SQ_SELL_COUNT;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/***REPORT_SHOP_SELL_LS : "report/shop_sell_ls",//门店销售记录***/
https.getReportShopSellList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_SHOP_SELL_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

//出库，入库
/**********REPORT_STORE_IN_OUT : "report/store_in_out" , //出入库统计***/
https.getReportStoreInOut = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_STORE_IN_OUT;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**********REPORT_STORE_IN_OUT_GOODS_LS : "report/store_in_out_goods_ls", //出入库流水***/
https.getReportStoreInOutGdLs = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_STORE_IN_OUT_GOODS_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/**********REPORT_BOOK_COUNT : "report/book_count", //预约统计***/
https.getReportBookCount = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_BOOK_COUNT;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}
/**********REPORT_BOOK_COUNT : "report/book_count", //服务统计***/
https.getReportShopCount = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_SHOP_COUNT;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}


/**********REPORT_BOOK_COUNT_LS : "report/book_count_ls", //预约统计详情***/
https.getReportBookCountList = async function (data, back) {
	let that = Vue.prototype;
	let api = that.$api;
	let url = config.REPORT_BOOK_COUNT_LS;
	let backData = null;
	let res = await api({
		url: url,
		data: data
	});
	if (res) {
		backData = res;
	}
	if (back != null) {
		back.apply(null, [backData]);
		back = null;
	}
	return;
}

/************报表****END*******/


export default https;